$(document).ready(function(){
	$(".link_viewDetailAccount").bind("click", function(e) {
		e.preventDefault();
		 var accountNumber = $(this).attr("data-viewDetailAccountNumber");
// 			 alert("hello MRS.NAM");
		 $("#popup_viewDetailAccount").fadeIn("fast", function(){
			 $.ajax({ 
		        type: 'get', 
		        url: 'viewDetailAccount', 
		        data:{
		        	accountNumber : accountNumber,
		        },
		        dataType: 'json',
		        success: function (data) { 
					console.log(data);
					$(".accountType").html(data.accountType);
					$(".accountNumber").html(data.accountNumber);
					$(".balance").html(data.balance);
					$(".fullName").html(data.idCardNumber.lastName+" "+data.idCardNumber.midName+" "+data.idCardNumber.firstName);
					$(".idCardNumber").html(data.idCardNumber.idCardNumber);
					$(".phoneHome").html(data.idCardNumber.phoneHome);
					$(".mobilePhone").html(data.idCardNumber.mobilePhone);
					$(".accountState").html(data.accountState);
					$(".email").html(data.idCardNumber.email);
					$(".address1").html(data.idCardNumber.address1);
					$(".address2").html(data.idCardNumber.address2);
		        },
		        error:function(XMLHttpRequest, textStatus, errorThrown) { 
		        	console.log("error ", textStatus, errorThrown, XMLHttpRequest); 
		        	$("#errorMessage").html(XMLHttpRequest.responseText);
		        }
		    });
		 });
	});
	
	$("#popup_close").bind("click",function(e){
		$("#popup_viewDetailAccount").fadeOut();
	});
});